﻿using UnityEngine;
using System.Collections;

public class BoardMove : MonoBehaviour
{

    public int speed = 10;
    public KeyCode up;
    public KeyCode down;
    private Rigidbody2D rigidBody2d;

    // Use this for initialization
    void Start()
    {
        rigidBody2d = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {

    }

    void FixedUpdate()
    {
        if (Input.GetKey(up))
        {
            rigidBody2d.velocity = new Vector2(0, speed );
        }
        else if (Input.GetKey(down))
        {
            rigidBody2d.velocity = new Vector2(0, -speed);
        }
        else
        {
            rigidBody2d.velocity = new Vector2(0, 0);
        }
    }
}
